using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// BBS_Plate - 论坛板块 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class IBBSPlate<T> :ModelBase<BBSPlate> where T : BBSPlate, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.PlateId = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return PlateId;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.PlateId=dy.PlateId;
           this.Title=dy.Title;
           this.Detailed=dy.Detailed;
           this.SubmitTime=dy.SubmitTime;
           this.IsName=dy.IsName;
           this.Sno=dy.Sno;
           this.Version=dy.Version;
        } 

        #region 定义属性

     
         /// <summary>
        /// 论坛板块ID
        /// </summary>
        private String _PlateId = "";
      
        /// <summary>
        /// 论坛板块ID
        /// </summary>
        public String PlateId
        {
            get 
            {
              return   (this._PlateId); 
            }

            set 
            {
                    _PlateId= value;  
            }
        }
       
     
         /// <summary>
        /// 名称
        /// </summary>
        private String _Title = "";
      
        /// <summary>
        /// 名称
        /// </summary>
        public String Title
        {
            get 
            {
              return   (this._Title); 
            }

            set 
            {
                    _Title= value;  
            }
        }
       
     
         /// <summary>
        /// 板块说明
        /// </summary>
        private String _Detailed = "";
      
        /// <summary>
        /// 板块说明
        /// </summary>
        public String Detailed
        {
            get 
            {
              return   (this._Detailed); 
            }

            set 
            {
                    _Detailed= value;  
            }
        }
       
     
         /// <summary>
        /// 创建时间
        /// </summary>
        private DateTime _SubmitTime =DateTime.MinValue;
      
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime SubmitTime
        {
            get 
            {
              return   (this._SubmitTime); 
            }

            set 
            {
                    _SubmitTime= value;  
            }
        }
       
     
         /// <summary>
        /// 是否可以匿名显示
        /// </summary>
        private int _IsName =-1;
      
        /// <summary>
        /// 是否可以匿名显示
        /// </summary>
        public yq.Enums.BooleanType IsName
        {
            get 
            {
              return  (yq.Enums.BooleanType)_IsName; 
            }

            set 
            {
                    _IsName= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 排序
        /// </summary>
        private int _Sno =int.MinValue;
      
        /// <summary>
        /// 排序
        /// </summary>
        public int Sno
        {
            get 
            {
              return   (this._Sno); 
            }

            set 
            {
                    _Sno= value;  
            }
        }
       
     
         
       

      #endregion 定义属性 

          protected internal override void SetValue(BBSPlate info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["PlateId"]!= DBNull.Value)
                  {
                  info.PlateId=row["PlateId"].ToString();
                 }
                 
                  
                  if(row["Title"]!= DBNull.Value)
                  {
                  info.Title=row["Title"].ToString();
                 }
                 
                  
                  if(row["Detailed"]!= DBNull.Value)
                  {
                  info.Detailed=row["Detailed"].ToString();
                 }
                 
                  
                  if(row["SubmitTime"]!= DBNull.Value)
                  {
                  info.SubmitTime=Convert.ToDateTime(row["SubmitTime"]);
                 }
                 
                  
                  if(row["IsName"]!= DBNull.Value)
                  {
                  info.IsName= (yq.Enums.BooleanType)(row["IsName"]) ;
                 }
                 
                  
                  if(row["Sno"]!= DBNull.Value)
                  {
                  info.Sno=Convert.ToInt32(row["Sno"]);
                 }
                 
                  
                  if(row["Version"]!= DBNull.Value)
                  {
                  info.Version=row["Version"].ToString();
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, BBSPlate info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@PlateId", DbType.String,ParameterTool.GetObj( info._PlateId )); 
            
             
                cn.AddInParameter(comm, "@Title", DbType.String,ParameterTool.GetObj( info._Title )); 
            
             
                cn.AddInParameter(comm, "@Detailed", DbType.String,ParameterTool.GetObj( info._Detailed )); 
            
             
                cn.AddInParameter(comm, "@SubmitTime", DbType.DateTime,ParameterTool.GetObj( info._SubmitTime )); 
            
             
                cn.AddInParameter(comm, "@IsName", DbType.Int32,ParameterTool.GetObj( info._IsName )); 
            
             
                cn.AddInParameter(comm, "@Sno", DbType.Int32,ParameterTool.GetObj( info._Sno )); 
            
                
                cn.AddInParameter(comm,"@Version", DbType.String, Guid.NewGuid().ToString());
              

                cn.AddInParameter(comm,"@_versionOdl", DbType.String, info._Version); 
                 
        } 

    } 
} 